﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;

namespace demobackground
{
    public partial class SoundPage : PhoneApplicationPage
    {
        private  string _soundsEnabledKey = "SoundsEnabled";
        public SoundPage()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(Settings_Loaded);
        }
        void Settings_Loaded(object sender, RoutedEventArgs e)
        {

            //if (IsolatedStorageSettings.ApplicationSettings.Contains(_soundsEnabledKey))
            //{
            //    var sounds = IsolatedStorageSettings.ApplicationSettings[_soundsEnabledKey].ToString();
            //    this.AmThanh.IsChecked = bool.Parse(sounds);
            //}
            App a = App.Current as App;
            this.AmThanh.IsChecked = a.tieng;
        }

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            IsolatedStorageSettings.ApplicationSettings[_soundsEnabledKey] = this.AmThanh.IsChecked;
            App a = App.Current as App;
            a.tieng = this.AmThanh.IsChecked.Value;
            NavigationService.GoBack();
        }
    }
}